package com.better.common.jwtauth.secruity;

import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 该接口用于在Spring Security登录过程中对用户的登录信息的详细信息进行填充，
 * 默认实现是JwtWebAuthenticationDetails，生成上面的默认实现JwtWebAuthenticationDetails
 * Created by Administrator on 2017/12/7.
 */
@Component
public class JwtAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails> {
    @Override
    public JwtWebAuthenticationDetails buildDetails(HttpServletRequest httpServletRequest) {
        return new JwtWebAuthenticationDetails(httpServletRequest);
    }
}
